home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 13 - 1997 (partial) / 13.05 May 97 / TidyHeap / DefaultCreateTidyHeap_AC.cp < prev    next >
Encoding:
Text File  |  1997-04-14  |  1.3 KB  |  48 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // DefaultCreateTidyHeap_AC.cp
  3. // Copyright © 1985-97 by Apple Computer, Inc. All rights reserved.
  4. //----------------------------------------------------------------------------------------
  5.  
  6. /*
  7.     Change History:
  8.         04/14/97    mwf        First Check in.
  9. */
  10.  
  11. // Usage Note:
  12. //        Do not include this file in your project if you define your own 'CreateTidyHeap',
  13. //        or if you are using TidyHeap with MacApp. This file is provided for folks who
  14. //        are using TidyHeap in their own framework, project or whatever. More than likely
  15. //        you'll want to use this file as a template for hooking TidyHeap into your 
  16. //        own memory management scheme.    
  17.  
  18. #if qTidyHeap
  19.  
  20. #ifndef __CTidyHeap_AC__
  21. #include "CTidyHeap_AC.h"
  22. #endif
  23.  
  24. #ifndef __MEMORY__
  25. #include <Memory.h>
  26. #endif
  27.  
  28. //----------------------------------------------------------------------------------------
  29. // CreateTidyHeap
  30. //----------------------------------------------------------------------------------------
  31.  
  32. inline void* NewPtrGlue_AC(unsigned long inSize)
  33. {
  34.     return ::NewPtr(inSize);
  35. }
  36. inline void DisposePtrGlue_AC(void* inPtr)
  37. {
  38.     ::DisposePtr( (char*) inPtr);
  39. }
  40. CTidyHeap_AC* CreateTidyHeap()
  41. {
  42.     CTidyHeap_AC::GlobalNew = NewPtrGlue_AC;
  43.     CTidyHeap_AC::GlobalDelete = DisposePtrGlue_AC;
  44.     return TH_new CTidyHeap_AC;
  45. }
  46.  
  47. #endif
  48.